package com.learn.xueer.ui.viewmodel

import androidx.lifecycle.MutableLiveData
import com.learn.xueer.app.network.apiService
import com.learn.xueer.data.model.bean.MessageResponse
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request

class MessageViewModel : BaseViewModel() {

    var messageResult = MutableLiveData<MessageResponse>()
    var messageContent = MutableLiveData<String>().apply { postValue("") }
    var messageTime = MutableLiveData<String>().apply { postValue("") }
    var noticeTime = MutableLiveData<String>().apply { postValue("") }
    var noticeContent = MutableLiveData<String>().apply { postValue("") }


    fun messageReq() {
        request({ apiService.messageList() }, {
            //请求成功 已自动处理了 请求结果是否正常
            messageResult.value = it
        }, {
            //请求失败 网络异常，或者请求结果码错误都会回调在这里

        }, true)

    }

}